package com.geekca.d4.work1;

public class FindMaxIndex {
    public static void main(String[] args) {
        int[] yanzhiArr = {15, 9000, 10000, 20000, 9500, -5};
        int max = yanzhiArr[0];
        int index = 0;
        for (int i = 1; i < yanzhiArr.length; i++) {
            if (yanzhiArr[i] > max) {
                max = yanzhiArr[i];
                index = i;
            }
        }
        System.out.println("最大值为: " + max + "其索引为: " + index);
    }
}
